<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8"/>
    <title>订单详情</title>
    <link rel="stylesheet" href="__ADMIN_STATICS__/bootstrap/dist/css/bootstrap.css" type="text/css" />
    <link rel="stylesheet" href="__ADMIN_STATICS__/animate.css/animate.css" type="text/css" />
    <link rel="stylesheet" href="__ADMIN_STATICS__/font-awesome/css/font-awesome.min.css" type="text/css" />
    <link rel="stylesheet" href="__ADMIN_STATICS__/simple-line-icons/css/simple-line-icons.css" type="text/css" />
    <link rel="stylesheet" href="__ADMIN_STATICS__/bootstrap-editable/css/bootstrap-editable.min.css" type="text/css" />
    <link rel="stylesheet" href="__ADMIN_STATICS__/app/css/font.css" type="text/css" />
    <link rel="stylesheet" href="__ADMIN_STATICS__/app/css/app.css" type="text/css" />
    <link rel="stylesheet" href="__ADMIN_STATICS__/bootstrap-touchspin/jquery.bootstrap-touchspin.min.css" type="text/css" />
    <link rel="stylesheet" href="__ADMIN_STATICS__/bootstrap-datetimepicker/bootstrap-datetimepicker.min.css" type="text/css" />
    <webuploadercss/>
</head>
<body>
<script src="__ADMIN_STATICS__/jquery/jquery.min.js"></script>
<script src="__ADMIN_STATICS__/bootstrap/dist/js/bootstrap.js"></script>
<div class="wrapper-md">
   <div class="panel panel-default">
    <div class="panel-heading">
        <a href="{:U('Admin/Index/welcome')}"><i class="fa fa-home"></i>&nbsp;首页&nbsp;</a>&gt;&nbsp;&nbsp;<a href="{:U('Admin/Goods/index')}">订单列表</a>&nbsp;&gt;&nbsp;&nbsp;订单详情
    </div>
    <div class="table-responsive">
        <form class="form-horizontal" action="{:U('Admin/Goods/edit')}" method="post"> 
            <!-- Nav tabs -->
            <ul class="nav nav-tabs text-center" role="tablist">
                <li role="presentation" class="active"><a href="#home" aria-controls="home" role="tab" data-toggle="tab">基础信息</a></li>
            </ul>
            <!-- Tab panes -->
            <div class="tab-content">
                <div role="tabpanel" class="tab-pane active" id="home">
                    <input type="hidden" name="id" value="{$data['id']}" />
                    <div class="line line-dashed b-b line-lg pull-in"></div>
                    <div class="form-group m-b-none m-l-none m-r-none">
                        <label class="col-sm-2 control-label" for="input-id-1">订单号</label>
                        <div class="col-sm-6">
                            <input type="text" class="form-control" readonly="true" value="{$data['order_sn']}">
                        </div>
                    </div>
                    <div class="line line-dashed b-b line-lg pull-in"></div>
                    <div class="form-group m-b-none m-l-none m-r-none">
                        <label class="col-sm-2 control-label">订单状态</label>
                        <div class="col-sm-6">
                            <select name="cateid" class="form-control">
                            	<option value="0" <if condition="0 eq $data['status']">selected</if>>未付款</option>
                            	<option value="1" <if condition="1 eq $data['status']">selected</if>>已付款</option>
                            </select>
                        </div>
                    </div>
                    <div class="line line-dashed b-b line-lg pull-in"></div>
                    <div class="form-group m-b-none m-l-none m-r-none">
                        <label class="col-sm-2 control-label" for="input-id-1">订单商品</label>
                        <div class="col-sm-6">
                            <volist name="data.items" id="d">
                            	<div>{$d['title']} * {$d['num']}</div>
                            </volist>
                        </div>
                    </div>

                    <div class="line line-dashed b-b line-lg pull-in"></div>
                    <div class="form-group m-b-none m-l-none m-r-none">
                        <label class="col-sm-2 control-label" for="input-id-1">订单金额</label>
                        <div class="col-sm-6">
                            <input type="text" class="form-control" readonly="true" value="{$data['totalprice']}">
                        </div>
                    </div>
                    <div class="line line-dashed b-b line-lg pull-in"></div>
                    <div class="form-group m-b-none m-l-none m-r-none">
                        <label class="col-sm-2 control-label" for="input-id-1">备注</label>
                        <div class="col-sm-6">
                            <input type="text" class="form-control" name="srclink" value="{$data['remark']}">
                        </div>
                    </div>
                    <div class="line line-dashed b-b line-lg pull-in"></div>
                    <div class="form-group m-b-none m-l-none m-r-none">
                        <label class="col-sm-2 control-label" for="input-id-1">付款时间</label>
                        <div class="col-sm-6">
                            <input type="text" class="form-control" value="{$data['paytime_desc']}" >
                        </div>
                    </div>
                </div>
                
            </div>
            <div class="line line-dashed b-b line-lg pull-in"></div>
            <div class="col-sm-4 col-sm-offset-2 m-b">
                <button type="submit" class="btn btn-primary">提交</button>
            </div>
        </form>
    </div>
  </div>
</div>
<div class="modal fade" id="preview" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-dialog">
         <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">
                    &times;
                </button>
                <h4 class="modal-title" id="myModalLabel">
                    图片预览
                </h4>
            </div>
            <div class="modal-body">
                <img src='' class="b b-a wrapper-xs bg-white img-responsive">
            </div>
        </div>
    </div>
</div>
<script src="__ADMIN_STATICS__/webuploader-0.1.5/webuploader.js"></script>
<script src="__ADMIN_STATICS__/webuploader-0.1.5/uploaderSf.js"></script>  
<script src="__ADMIN_STATICS__/bootstrap-touchspin/jquery.bootstrap-touchspin.min.js"></script>  
<script src="__ADMIN_STATICS__/bootstrap-datetimepicker/bootstrap-datetimepicker.min.js"></script>  
<script src="__ADMIN_STATICS__/bootstrap-datetimepicker/locales/bootstrap-datetimepicker.zh-CN.js"></script>
<script type="text/javascript" src="http://api.map.baidu.com/api?v=2.0&ak=Q0AWXP9FNzYvVy6zRAGy8sKs7lWzAZO7"></script>
<script type="text/javascript">
var address = $('input[name="address"]').val();
var lng = $("#lng").val();
var lat = $("#lat").val();
if(address == '' || lng == '' || lat == ''){
    var point = new BMap.Point(116.404, 39.915);
}
if(lng != '' && lat != ''){
    var point = new BMap.Point(lng,lat);
}
// 百度地图API功能
var map = new BMap.Map("allmap",{minZoom:10,maxZoom:20});            // 创建Map实例
  // 添加带有定位的导航控件
var navigationControl = new BMap.NavigationControl({
    // 靠左上角位置
    anchor: BMAP_ANCHOR_TOP_LEFT,
    // LARGE类型
    type: BMAP_NAVIGATION_CONTROL_LARGE,
    // 启用显示定位
    enableGeolocation: true
});
map.addControl(navigationControl);
map.enableScrollWheelZoom(true);     //开启鼠标滚轮缩放

var marker = new BMap.Marker(point);  // 创建标注
map.addEventListener("click", function(e){
    var point = new BMap.Point(e.point.lng,e.point.lat);
    map.clearOverlays();
    map.addOverlay(new BMap.Marker(point));
    setPoint(point);
});
map.addOverlay(marker);               // 将标注添加到地图中
map.centerAndZoom(point, 20);

function edit(obj){
    // 创建地址解析器实例
    var myGeo = new BMap.Geocoder();
    var param = $('input[name="address"]').val();
    console.log(param);
    myGeo.getPoint(param, function(point){      
          if (point) {      
                map.centerAndZoom(point, 20);
                map.clearOverlays();      
                map.addOverlay(new BMap.Marker(point));
                setPoint(point);      
          }      
      }, "南宁市");
}

function setPoint(point){
    var lng = point.lng;
    var lat = point.lat;
    $('#lng').val(lng);
    $('#lat').val(lat);
}
</script>  
<script type="text/javascript">
upload_init('pic',false,'goods');
getExpand();

$('a[data-toggle="tab"]').on('shown.bs.tab', function (e) {
    // 获取已激活选项卡的名称
    var activeTab = $(e.target).attr('aria-controls');
    var multiple = false;
    var type = 'goods';
    if (activeTab == "album") {
        multiple = true;
    }
    if (activeTab == 'attachment') {
        type = 'file';
    }
    // 初始化上传组件
    upload_init(activeTab,multiple,type);
});

function upload_init(activeTab,multiple,type){
     $('#'+activeTab+'_upload').sfUpload({
        url:"/index.php?m=Admin&c=Goods&a=upload&type="+type,
        picker:activeTab+'_upload',
        multiple:multiple,
        success:function( data ) {
            if(activeTab == 'album'){
                var str = '<input name="album_path[]" type="hidden" value="'+data.path;
                str += '"/><input name="album_name[]" type="hidden" value="'+data.original;
                str += '"/>';
                $('.album_list').append(str);
            }else{
                $("input[name='cover']").val(data.path);
            }
        },
        error:function( err ) {
            console.info( err );    
        }
    });
}
$("input[name='look_count']").TouchSpin({
    min: 0,
    max: 99999999,
    step: 1,
    decimals: 0,
    boostat: 5,
    maxboostedstep: 10,
    postfix: '次'
});

function delete_album(obj){
    var id = $(obj).attr('data-id');
    $.ajax({
        url : "{:U('Admin/Goods/delete_album')}",
        type : "post",
        dataType : "json",
        data : {id:id},
        success : function(data){
            if(data.code){
                $('.album_'+id).remove();
            }else{
                alert(data.msg);
            }
        }
    });
}

function delete_logo(obj){
    var path = $(obj).attr('data-path');
    var id = $(obj).attr('data-id');
    $.ajax({
        url : "{:U('Admin/Goods/delete_logo')}",
        type : "post",
        dataType : "json",
        data : {path:path,id:id},
        success : function(data){
            console.log(data)
            if(data.code){
                $('#logo').remove();
            }else{
                alert(data.msg);
            }
        }
    });
}


function preview(obj){
    var path = $(obj).attr('data-url');
    $('#preview img').attr('src', path);
    $('#preview').modal('show');
}

$('#datetimepicker').datetimepicker({
    format: "yyyy-mm-dd",
    autoclose: true,
    todayBtn: true,
    language:  'zh-CN',
    minView: "month",
});

function getExpand(){
    var cid = $("select[name='cateid']").find("option:selected").val();
    var aid = "{$data['id']}";
    $.ajax({
        type : 'post',
        url : "{:U('Admin/Goods/getExpandAjax')}",
        data : {cid:cid,aid:aid},
        dataType : 'json',
        success : function(data){
            console.log(data);
            if (data.data.content == 1) {
                $('#content_config').show();
            }else{
                $('#content_config').hide();
            }
            if (data.data.seo == 1) {
                $('#seo_config').show();
            }else{
                $('#seo_config').hide();
            }
            if (data.data.attachment == 1) {
                $('#attachment_config').show();
            }else{
                $('#attachment_config').hide();
            }
            if (data.data.album == 1) {
                $('#album_config').show();
            }else{
                $('#album_config').hide();
            }
            if (data.data.address == 1) {
                $('#address_config').show();
            }else{
                $('#address_config').hide();
            }
            $('#expand').html(data.str);
        }
    });
}

</script>
</body>
</html>
